cmake_minimum_required(VERSION 3.22)

project(piccolo_platform)

add_library(piccolo_platform
        Private/PiccoloLog.cpp
        Private/PiccoloWindow.cpp
        Private/Window/PiccoloGLFWWindow.cpp
        Private/Graphics/PiccoloGraphicsContext.cpp
        Private/Graphics/PiccoloVKGraphicsContext.cpp
        Private/Graphics/PiccoloVKDevice.cpp
        Private/Graphics/PiccoloVKQueue.cpp
        Private/Graphics/PiccoloVKSwapchain.cpp
        Private/Graphics/PiccoloVKRenderPass.cpp
        Private/Graphics/PiccoloVKFrameBuffer.cpp
        Private/Graphics/PiccoloVKImageView.cpp
        Private/Graphics/PiccoloVKPipeline.cpp
        Private/Graphics/PiccoloVKCommandBuffer.cpp
        Private/Graphics/PiccoloVKImage.cpp
        Private/PiccoloGeometryUtil.cpp
        Private/Graphics/PiccoloVKBuffer.cpp
        Private/Graphics/PiccoloVKDescriptorSet.cpp
        Private/Event/PEventDispatcher.cpp
        Private/Event/PEventObserver.cpp
)

target_include_directories(piccolo_platform PUBLIC External)

# glfw
option(GLFW_BUILD_DOCS OFF)
option(GLFW_BUILD_TESTS OFF)
option(GLFW_BUILD_EXAMPLES OFF)
option(GLFW_INSTALL OFF)

add_subdirectory(External/glfw)
target_link_libraries(piccolo_platform PRIVATE glfw)

# glm
add_subdirectory(External/glm)
target_link_libraries(piccolo_platform PRIVATE glm)


# Vulkan
find_package(Vulkan REQUIRED)
if (Vulkan_FOUND)
    message("----> Find vulkan success: ${Vulkan_INCLUDE_DIRS}")
endif()
target_include_directories(piccolo_platform PUBLIC ${Vulkan_INCLUDE_DIRS})
target_link_libraries(piccolo_platform PRIVATE ${Vulkan_LIBRARIES})
